﻿ @{
     Lang lang = ViewBag.Lang;  
 } 
@{    
    ViewBag.Title = ViewBag.PageTitle = @lang.TitleSearch;
    Layout = "~/Views/Shared/_Layout_About.cshtml";
}


@Html.Partial("~/Views/FlightSearch/_SearchPartial.cshtml")

<script>
    $('html, body').animate({
        scrollTop: $("#ssearch").offset().top
    }, 2000);
    //$(document).ajaxStart(function () {
    //    $("#wait").css("display", "block");
    //});
    //$(document).ajaxComplete(function () {
    //    $("#wait").css("display", "none");
    //});
    function loadData() {
        debugger;
        $("#wait").css("display", "block");
        //$("#wait").removeClass("none");
        //$("#wait").addClass("display");
        var SessionID = '@ViewBag.Key';
        var fromcity = '@ViewData["fromcity"]';
        $("#fromcity").val(fromcity);
        var tocity = '@ViewData["tocity"]';
        $("#tocity").val(tocity);
        var DatePickerDepartDate = '@ViewData["DatePickerDepartDate"]';
        if (DatePickerDepartDate != null) {
            var res = DatePickerDepartDate.substring(0, 2);
           
        }
        var DatePickerReturnDate = '@ViewData["DatePickerReturnDate"]';
        var Adult = '@ViewData["Adult"]';
        var Child = '@ViewData["Child"]';
        var Baby = '@ViewData["Baby"]';
        var Ways = '@ViewData["Ways"]';

        $.ajax({

            url: '/FlightSearch/_ListResultOutMobile',
            data: {
                SessionID: SessionID, fromcity: fromcity, tocity: tocity,
                DatePickerDepartDate: DatePickerDepartDate, DatePickerReturnDate: DatePickerReturnDate,
                Adult: Adult, Child: Child, Baby: Baby
            },
            type: "Get",
            contentType: "application/text; charset=utf-8",
            success: function (result) {
                $("#view-search-result").html(result);
                $("#wait").css("display", "none");
                return;
            },
            error: function (xhr, status, error) {
            }
        });
        if ('@ViewData["DatePickerReturnDate"]' != null) {
            $("#wait").css("display", "block");
            $.ajax({

                url: '/FlightSearch/_ListResultInMobile',
                data: {
                    SessionID: SessionID, fromcity: fromcity, tocity: tocity,
                    DatePickerDepartDate: DatePickerDepartDate, DatePickerReturnDate: DatePickerReturnDate,
                    Adult: Adult, Child: Child, Baby: Baby
                },
                type: "Get",
                contentType: "application/text; charset=utf-8",
                success: function (result) {
                    $("#view-search-result-return").html(result);
                    $("#wait").css("display", "none");
                    return;
                },
                error: function (xhr, status, error) {
                    $("#wait").css("display", "none");
                }
            });
        }
    }

    loadData();
</script>
<style>
    .display {
        display: block;
    }

    .none {
        display: none;
    }
    .sub-title {
display: block;
background-color: #D61321;
color: white;
padding: 5px;
margin:10px 0px 10px 0px;
}
    .f-des-time {
font-size: 24px;
color: #D61321;
}
    .f-city {
font-size: 24px;
color: #122738;
}
    .f-des {
color: gray;
font-size: 16px;
}
</style>
<div>
    
    <h2 class="sub-title">
        @lang.OUTBOUND
    </h2>
    <p class="f-des">
        @lang.FROM <b class="f-city">@ViewData["fromcity"]</b> @lang.TO <b class="f-city">@ViewData["tocity"]</b>
        <br />@lang.FLIGHTDATE <b class="f-des-time">
            @{
                var datePickerDepartDate = ViewData["DatePickerDepartDate"];
                if (datePickerDepartDate != null)
                {
                    var x1 = ((DateTime)ViewData["DatePickerDepartDate"]).ToString("dd/MM/yyyy");
                <span>@x1</span>
                }
            }

        </b>
        <br />
    </p>
    <p>
        + Giá vé đã bao gồm <b>thuế</b> và <b>phí</b><br />
        + Giá vé chỉ áp dụng cho hình thức chuyển khoản<br />
        + Giao vé tại nhà phí 25.000 vnd/vé
    </p>
</div>
<div id="view-search-result">
</div>
@{
    if (ViewData["DatePickerReturnDate"] != null)
    {
    <div>
        <h2 class="sub-title">
            @lang.INBOUND
        </h2>
        <p class="f-des">
            @lang.FROM <b class="f-city">@ViewData["tocity"]</b> @lang.TO <b class="f-city">@ViewData["fromcity"]</b>
            <br />@lang.FLIGHTDATE <b class="f-des-time">@(((DateTime)(ViewData["DatePickerReturnDate"])).ToString("dd/MM/yyyy"))</b>
            <br />
        </p>
        <p>
            + Giá vé đã bao gồm <b>thuế</b> và <b>phí</b><br />
            + Giá vé chỉ áp dụng cho hình thức chuyển khoản<br />
            + Giao vé tại nhà phí 25.000 vnd/vé
        </p>

    </div>
    <div id="view-search-result-return">
    </div> 
    }
}

@using (Html.BeginForm("Booking", "FlightSearch", FormMethod.Post))
{
    <input type="hidden" name="SessionID" id="SessionID" value="@ViewBag.Key" />
    <input type="hidden" name="DepartTicket" id="DepartTicket" />
    <input type="hidden" name="ReturnTicket" id="ReturnTicket" />
    <input type="submit" class="btn-index btn-8 btn-8c" value="Ðặt Vé" />

}
<div id="wait" class="block" style="width: 69px; height: 89px; position: absolute; top: 50%; left: 50%; padding: 2px;">
    <img src='/Content/themes/smartphone/images/icon-wait.gif' width="64" height="64" /><br>
  
</div>
